package fr.ginvest.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
public class Stade implements Serializable {

	private static final long serialVersionUID = 8682235928979506411L;
	
	public enum Etape {CANDIDATURE,EXPOSITION,AUDIT,NEGOCIATION,ENGAGEMENT}
	public enum Etat{NON_TRAITE, VALIDE, REFUSE}
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO) 
	private int id;
	
	@Temporal(TemporalType.DATE)
	private java.util.Date date;
	
	@Enumerated(EnumType.STRING)
	@Column(length=11,nullable=false)
	private Etape etape;
	
	@Enumerated(EnumType.STRING)
	@Column(length=10, nullable=false)
	private Etat etat;
	
	@Column(length=5000)
	private String description;

	public Stade() {}
	
	public Stade( Etape etape) {
		super();
		this.etape = etape;
		this.date = new Date();
		this.etat = Etat.NON_TRAITE;
	}

	public Stade( Etape etape, Date date, String description) {
		super();
		this.date = date;
		this.etape = etape;
		this.etat = Etat.NON_TRAITE;
		this.description = description;
	}
		
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Stade other = (Stade) obj;
		if (id != other.id)
			return false;
		return true;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public java.util.Date getDate() {
		return date;
	}

	public void setDate(java.util.Date date) {
		this.date = date;
	}

	public Etape getEtape() {
		return etape;
	}

	public void setEtape(Etape etape) {
		this.etape = etape;
	}

	public Etat getEtat() {
		return etat;
	}

	public void setEtat(Etat etat) {
		this.etat = etat;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}		

}
